UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M0iP6dTKFK4a+1SgrW3b7Y2fxazSJBKyUgjx2d6NTdk=' 
WHERE 
  key_id = 'bd843edb3865ece74aa8526918e5d7abc07617f88a9dfbb05779aad64dee413a' 
  AND (
    token = 'M0iP6dTKFK4a+1SgrW3b7Y2fxazSJBKyUgjx2d6NTdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029