UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CgD4OqT6w0CIIF8BeU5dOVSaqRX+QD/AnyvQLGMHGhY=' 
WHERE 
  key_id = 'd44340a064df8bbfec3e3f0418edb9c361e13caece315deeb29246334d2967c4' 
  AND (
    token = 'CgD4OqT6w0CIIF8BeU5dOVSaqRX+QD/AnyvQLGMHGhY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043