UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8amlczN57lVdM3y7n1viZsPSLakZ/5TaagvkmFf2WWE=' 
WHERE 
  key_id = 'c7a3774d669e92ae56a8000aeacdf765d37eafb20f0a6ba7b4c1e6f56bb3c929' 
  AND (
    token = '8amlczN57lVdM3y7n1viZsPSLakZ/5TaagvkmFf2WWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022