UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BtNg4eqJIg6Ta1TQW03seINKsypjgdPmxw/K0M14Yms=' 
WHERE 
  key_id = '3420c8986d682064c8295ecc2efaa306010455c1e6c5070233d770ba2d8ab3f7' 
  AND (
    token = 'BtNg4eqJIg6Ta1TQW03seINKsypjgdPmxw/K0M14Yms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046