UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z8xR8YA018C8f3U7c96RvgnvAOUU/0rLvnERRK1SGlQ=' 
WHERE 
  key_id = 'd4588057dfc5c8a35b684d877385c611b870a6cdb4239cb27fbfd94ba8d5adfd' 
  AND (
    token = 'Z8xR8YA018C8f3U7c96RvgnvAOUU/0rLvnERRK1SGlQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038