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

Query time 0.00028