UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5d251tD+gMcpHXkuEn39XURdfYnypZpZTSO6Jg+6IqI=' 
WHERE 
  key_id = '6416e4f8ddcb74ac1b13bb90938761c94123a1fa62e85284f537655346f51570' 
  AND (
    token = '5d251tD+gMcpHXkuEn39XURdfYnypZpZTSO6Jg+6IqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049