UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E2a+EDI7+4zJbpml6HmFBLhL5KCl5anliiY1GSTsihk=' 
WHERE 
  key_id = '67c710e20c72607ad685740dbddc834146bce4afefb53932f5226f4d11555728' 
  AND (
    token = 'E2a+EDI7+4zJbpml6HmFBLhL5KCl5anliiY1GSTsihk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030