UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5GXV+kAZKRD2MNAO1Zlmem4stDamb+JHG5rlwmg+27s=' 
WHERE 
  key_id = '5a437309aeb9d54b6b96edf06e0061b2f99edaf2176bfaed2eaa814101131e5c' 
  AND (
    token = '5GXV+kAZKRD2MNAO1Zlmem4stDamb+JHG5rlwmg+27s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023