UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Khz2sk0S+i4yOJ3E/ug3ES1D52nnvdZ4h2X2yNK78c0=' 
WHERE 
  key_id = '4fa297e3749338ee3411f375819b6fcda76157e541f50af93bdf96d51eead098' 
  AND (
    token = 'Khz2sk0S+i4yOJ3E/ug3ES1D52nnvdZ4h2X2yNK78c0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037