UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yrppaWQqIjZ0O0C6sWXC957VhS27OsAcaIvJe+0UWf0=' 
WHERE 
  key_id = '2a139a8230f30ee9427781e8f29d50a36e72f0c6874182d6e1fa2c03ac44c1cf' 
  AND (
    token = 'yrppaWQqIjZ0O0C6sWXC957VhS27OsAcaIvJe+0UWf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033