UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UW7G6BD/k7XH58V+ySlr2dp6cFjJPjM1oDdY18DLYzc=' 
WHERE 
  key_id = '38ccc934c75104f6b583aa4e409202efb065e5c84c925fb467cb66cdb7d3ca8d' 
  AND (
    token = 'UW7G6BD/k7XH58V+ySlr2dp6cFjJPjM1oDdY18DLYzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030