UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nd0rxEblvSm8KHesxtpF78uTJgePYl/cj7cfsrmJDRM=' 
WHERE 
  key_id = '4307373e480d9a01633712b1f7eba222d7084f9d9166315b8f87681366f1985f' 
  AND (
    token = 'Nd0rxEblvSm8KHesxtpF78uTJgePYl/cj7cfsrmJDRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034