UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I/ty31rJd97hIKqYsQguU+JvQ/zVwpkD3qWAQx8zYs4=' 
WHERE 
  key_id = 'd1c4655a5eb08ce1b08f73ba208e86a6e00ceaa3793e6767d433edcc52d5d20c' 
  AND (
    token = 'I/ty31rJd97hIKqYsQguU+JvQ/zVwpkD3qWAQx8zYs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034