UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rm89lSVMJ4lvAvy+7WIxOjQu98/lhvcYIAAhHC/Bom8=' 
WHERE 
  key_id = '5079f92483ff6c482fd5cd007d7637d791e3321bdcd7913df3c67cddb970d256' 
  AND (
    token = 'Rm89lSVMJ4lvAvy+7WIxOjQu98/lhvcYIAAhHC/Bom8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024