UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pjXVn6XFE8nfM1WL01WG3joQ2ZrwyvsukHMMpsxLRKQ=' 
WHERE 
  key_id = 'af5ac4c209a29df7b481f992eb8f30d1851c335fd33c529b968b4567d0468549' 
  AND (
    token = 'pjXVn6XFE8nfM1WL01WG3joQ2ZrwyvsukHMMpsxLRKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036