UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NyccoyyUuDpKKh4mQWBSgBxosuK2z3cawE+o3bVTcvY=' 
WHERE 
  key_id = '4019299899468afd98a9f3a53c499a3b3e402b1df78a84191efdce8987e18453' 
  AND (
    token = 'NyccoyyUuDpKKh4mQWBSgBxosuK2z3cawE+o3bVTcvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026