UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '39VO/T7pwdRO1KU9amwwwkK9kLlmrd39MIdF7adLwG4=' 
WHERE 
  key_id = '19ae736804763e7c4065efae9953284899d6bb79d3f5003d4d362d6d4c3d0458' 
  AND (
    token = '39VO/T7pwdRO1KU9amwwwkK9kLlmrd39MIdF7adLwG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034