UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p/iKaIbJOh/gcb1BN824gWJZ3C4mjp6Pc6GG58LMAgE=' 
WHERE 
  key_id = '683dd8218ee80636563af32a257c9f480782f348dd006c7356527f5fd9046b6b' 
  AND (
    token = 'p/iKaIbJOh/gcb1BN824gWJZ3C4mjp6Pc6GG58LMAgE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052