UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pJkwbDlbjW89KxisTmn8fVDGWDcdo0Kfgcd365PS0go=' 
WHERE 
  key_id = '9999c5c6f480bce3daa68c435b4317310ffd4ec825452b11d19a7cbcc22edc26' 
  AND (
    token = 'pJkwbDlbjW89KxisTmn8fVDGWDcdo0Kfgcd365PS0go=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020