UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bw7CdQRG+y7ZJY0iqOO+DxpUm5ltTI0UDzf1wChV/i4=' 
WHERE 
  key_id = '7435260bc36d2578188d012f9523cb27f6aa499c378e0e5ee6a2f1fff5d3789c' 
  AND (
    token = 'Bw7CdQRG+y7ZJY0iqOO+DxpUm5ltTI0UDzf1wChV/i4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031