UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6MsnmFEfmo5octr3o4bggA+yAmvHQs+6BcsKGB8tB6I=' 
WHERE 
  key_id = 'fa77c5ba8d5e83743562757b3eae61724884572c52f2e94e4c2398248f53e64e' 
  AND (
    token = '6MsnmFEfmo5octr3o4bggA+yAmvHQs+6BcsKGB8tB6I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057