UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zy88U8pnuzhVetryaMHUC8I0hmDiBDxn++3ypHoS5EI=' 
WHERE 
  key_id = '076ac44faea41782b27a98bbd8b06f31e428b7c5b95ac84f820051af8ae4fa3f' 
  AND (
    token = 'Zy88U8pnuzhVetryaMHUC8I0hmDiBDxn++3ypHoS5EI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032