UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YQiAsb6oqKQjDq1J7U+UDyraBCoRlX+8bLvQtQPrzwY=' 
WHERE 
  key_id = '364fa3a7267b191e14ae692fb66f155889bc9b767aa25f572ccaa440c43a70b2' 
  AND (
    token = 'YQiAsb6oqKQjDq1J7U+UDyraBCoRlX+8bLvQtQPrzwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033