UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lYbofdW62FOYhN3Lc++vmgO12KMVR++6h+d73jv70KQ=' 
WHERE 
  key_id = 'ac23848cdd83da621a5f6892fb10fdac3f83e46734f35dc328903bccaca85807' 
  AND (
    token = 'lYbofdW62FOYhN3Lc++vmgO12KMVR++6h+d73jv70KQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037