UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IOljvILj+to0zZvSx3l+AaOm0r+POBkUmWL7HLpqYXs=' 
WHERE 
  key_id = '10c6253833770361644f53ca2e0ecaddeaa7555bff44099f87382dc0875e7ba3' 
  AND (
    token = 'IOljvILj+to0zZvSx3l+AaOm0r+POBkUmWL7HLpqYXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045