UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kMGPszKA5EG9EFkw8+8/GQ0Csv9e5/Li3pANyW9Py2Q=' 
WHERE 
  key_id = '30fa23560bd7c14848b497eefc84067707b4cd9d9be2f41346c064f06d921d65' 
  AND (
    token = 'kMGPszKA5EG9EFkw8+8/GQ0Csv9e5/Li3pANyW9Py2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038