UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aPQjaJmT8R/wvuI90aDghztiqSrqArrDtY2aWIrioNs=' 
WHERE 
  key_id = 'fa1b4832c3d22005515be861ef1ab697e0b0c978a0234db90ffb0366b57fe2db' 
  AND (
    token = 'aPQjaJmT8R/wvuI90aDghztiqSrqArrDtY2aWIrioNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038