UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'heIQaP2xX9JQEUQm5D2AtecM/1cZ40murU6bsA3y3sU=' 
WHERE 
  key_id = '508a7dc849230748099a6f8ca783822f8a7132ff917630c83bcd156ddd1bee3e' 
  AND (
    token = 'heIQaP2xX9JQEUQm5D2AtecM/1cZ40murU6bsA3y3sU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040