UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HKzOkWwIf3VEQwtIsb9UM2pZQENsLq97ssWng7p12gc=' 
WHERE 
  key_id = 'a8caae9aefcf7fd1533abb53bef29d0a72e300ff2bf2cd5a887b84f23876841d' 
  AND (
    token = 'HKzOkWwIf3VEQwtIsb9UM2pZQENsLq97ssWng7p12gc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036