UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZJM4b3uUQ83vghO1EjmtJ0VTHl9LdBWXzT8TYxKroX8=' 
WHERE 
  key_id = '6168487551aaa5d2d0f545dac5f256772fbaf850b309d9cb968c9c8f464ff95a' 
  AND (
    token = 'ZJM4b3uUQ83vghO1EjmtJ0VTHl9LdBWXzT8TYxKroX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034